import config from "@/config"
import http from "@/utils/request"


// 项目
export default {
  // 项目管理
  getProjects: {
    url: `${config.API_URL}/project/pageList`,
    name: "获取项目管理列表",
    get: async function (data) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  addProject: {
    url: `${config.API_URL}/project/add`,
    name: "添加项目",
    post: async function (data) {
      return new Promise((resolve, reject) => {
        http.post(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  updateProject: {
    url: `${config.API_URL}/project/update`,
    name: "修改项目",
    post: async function (data) {
      return new Promise((resolve, reject) => {
        http.post(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  deleteProject: {
    url: `${config.API_URL}/project/delete`,
    name: "删除项目",
    post: async function (data) {
      return new Promise((resolve, reject) => {
        http.postParam(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  getUserList: {
    url: `${config.API_URL}/project/adminList`,
    name: "获取所有用户列表",
    get: async function (data) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  submitCheck: {
    url: `${config.API_URL}/project/commitAudit`,
    name: "提交项目审核",
    post: async function (data) {
      return new Promise((resolve, reject) => {
        http.postParam(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  checkProject: {
    url: `${config.API_URL}/project/audit`,
    name: "审核项目",
    post: async function (data) {
      return new Promise((resolve, reject) => {
        http.postParam(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },



}
